Skip to content
This repository was archived by the owner on Sep 11, 2019. It is now read-only.

Replaced btoa and atob that have a problem with handling Unicode characters with code by Johan Sundström.#4

Open
zigah wants to merge 2 commits intoplaygameservices:masterfrom
zigah:master
Open

Replaced btoa and atob that have a problem with handling Unicode characters with code by Johan Sundström.#4
zigah wants to merge 2 commits intoplaygameservices:masterfrom
zigah:master

Conversation

@zigah
Copy link

@zigah zigah commented Nov 3, 2013

These two new functions in b64Utils.js are intended to replace btoa and atob that have a problem with handling Unicode caharacters in a player's g+ name - like mine :P - and throw an exception, which prevents the Brag button to populate.

The functions below were effectively copy pasted from ecmanaut.blogspot.com
as suggested by MDN: https://developer.mozilla.org/en-US/docs/Web/API/window.btoa
and written by Johan Sundström:

"In most browsers, calling window.btoa on a Unicode string
will cause a Character Out Of Range exception.
To avoid this, consider this pattern, noted by Johan Sundström:"
http://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments